#!/usr/bin/python


import logging
logger = logging.getLogger("xul_constants")


import sys


from xpcom import components # to use components

# extension constants
PATH_MAIN = components.classes['@mozilla.org/file/directory_service;1'].getService(
	components.interfaces.nsIProperties).get("ProfD", components.interfaces.nsILocalFile).path
PATH_EXTENSION = PATH_MAIN + "/extensions/nepomukfoxtrot@nepomuk.semanticdesktop.org/"
PATH_CONTENT = PATH_EXTENSION + "chrome/content/"

PATH_SCRIPTS = PATH_CONTENT + "scripts/"
PATH_COMPONENTS = PATH_EXTENSION + "components/"

ONTOLOGIES_STORAGE_FILE = PATH_CONTENT + "ontologies.pkl"

PROMPTS = components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(components.interfaces.nsIPromptService);


############################################################


# be able to use dbus
sys.path.append(PATH_CONTENT + "/dbus/")
sys.path.append(PATH_CONTENT + "/dbus/dbus/")
logger.debug("using \"onsite\" dbus!")

"""
import dbus
try:
	import dbus
except ImportError, e:
	# TODO: have that prompt in the xul pages, not in a constants file...
	# PROMPTS.alert(window, "Error", "DBus can not be found. Make sure you have python-dbus installed in /usr/lib/python2.5/site-packages. This error can sometimes appear at startup, so maybe restrating firefox would do the trick.")
"""


# be able to use our python scripts and our components
sys.path.append(PATH_SCRIPTS)
sys.path.append(PATH_COMPONENTS)


############################################################


# import all python constants for the scripts to have them
from constants import *
from my_exceptions import *



logger.debug("xul_constants has been imported")